package com.portal.sso.core.config;

public enum PortalResault {
    OK(0, "访问正常"),
    CACHE_SHUT(1, "缓存宕机"),
    NOT_TGT(405,"没有定义tgt参数"),
    NOT_APP_ID(406,"没有定义appid"),
    ERR_TGT_LICIT(407,"得到的tgt不合法或不存在"),
    ERR_SSO_NOT_WHITELIST(408,"此服务ip没有在ssoServer上设置白名单"),
    ERR_NULL_USERID(409,"用户id为空"),
    ERR_NULL_PWD(410,"pwd值为空"),
    ERR_USER_PWD(411,"用户名或密码不正确"),
    ERR_FAILURE(500,"操作失败")
            ;
    /**
     * 代码
     */
    private final int code;

    /**
     * 描述
     */
    private final String desc;
    PortalResault(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }
    public static PortalResault fromValue(int code) {
        PortalResault[] its = PortalResault.values();
        for (PortalResault it : its) {
            if (it.code()==code) {
                return it;
            }
        }
        return OK;
    }

    public int code() {
        return this.code;
    }

    public String desc() {
        return this.desc;
    }
}
